

#ifndef _SPI_SIMULATOR_H
#define _SPI_SIMULATOR_H


#include "stm8l15x_gpio.h"
#include "Taskhandler.h"

#define SPI_CLK_PORT GPIOC
#define SPI_CLK_PIN GPIO_Pin_3

#define SPI_SDO_PORT GPIOC
#define SPI_SDO_PIN GPIO_Pin_2

#define SPI_SDI_PORT GPIOE
#define SPI_SDI_PIN GPIO_Pin_7

#define SPI_CS_PORT GPIOE
#define SPI_CS_PIN GPIO_Pin_6

#define SPI_CLK_HIGH() GPIO_SetBits(SPI_CLK_PORT, SPI_CLK_PIN)
#define SPI_CLK_LOW() GPIO_ResetBits(SPI_CLK_PORT, SPI_CLK_PIN)

#define SPI_SDO_PIN_DATA() GPIO_ReadInputData(SPI_SDO_PORT)

#define SPI_SDI_HIGH() GPIO_SetBits(SPI_SDI_PORT, SPI_SDI_PIN)
#define SPI_SDI_LOW() GPIO_ResetBits(SPI_SDI_PORT, SPI_SDI_PIN)

#define SPI_CS_Enable() GPIO_ResetBits(SPI_CS_PORT, SPI_CS_PIN)
#define SPI_CS_Disable() GPIO_SetBits(SPI_CS_PORT, SPI_CS_PIN)



void SPIIOConfiguration(void);
void SPIReadBytes(unsigned char *OutBuff,unsigned char len);
unsigned char SPIReadOneByte(void);
void SPIWriteBytes(const unsigned char *InBuff,unsigned char len);
void SPIWriteOneByte(unsigned char dat);




#endif
